
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.List;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 *
 * @author Mr Bao
 */
public class ViewImageNameNew extends List implements Runnable, CommandListener {

    private UpAnh upAnh;
    private Command cmdBack = new Command("Back", Command.BACK, 2);

    public ViewImageNameNew(UpAnh upAnh) {
        super("Anh moi upload", IMPLICIT);
        this.upAnh = upAnh;
        addCommand(cmdBack);
        setCommandListener(this);
        new Thread(this).start();
    }

    public void run() {
        while (true) {
            if (upAnh.client.listImageName.size() > 0) {
                String str = upAnh.client.listImageName.elementAt(0).toString();
                if (str.equals("ENDIMAGENAME")) {
                    upAnh.client.listImageName = null;
                    break;
                } else {
                    append(str, null);
                    upAnh.client.listImageName.removeElementAt(0);
                }
            }
        }
    }

    public void commandAction(Command c, Displayable d) {
        if (c == cmdBack) {
            upAnh.DisplayViewImage();
        } else if (c == SELECT_COMMAND) {
            upAnh.DisplayImageViewNew(getSelectedIndex());
        }
    }
}
